<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/9/7
  Time: 14:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="../common.jsp" %>
<html>
<head>
    <title>Title</title>
    <script src="${pageContext.request.contextPath}/static/echarts/echarts.js"></script>
</head>
<body>
<div id="result" style="width: 100%;height: 100%"></div>
</body>
<script>
    layui.config({
        version: 1,
        base: 'echarts/'
    }).use(['element', 'echarts', 'carousel'], function () {
        var element = layui.element,
            $ = layui.jquery,
            carousel = layui.carousel,
            echarts = layui.echarts;
        $.ajax({
            url: "${pageContext.request.contextPath}/viewTestResultMht/queryAll.do",
            dataType: "json",
            type: "post",
            success: function (re) {
                var chartDom = document.getElementById('result');
                var myChart = echarts.init(chartDom);
                var option;

                option = {
                    title: {
                        text: '心理健康Mht测试',
                        subtext: '测试人数：' + (Number(re.data.zf)),
                        left: 'center'
                    },
                    tooltip: {
                        trigger: 'item'
                    },
                    legend: {
                        orient: 'vertical',
                        left: 'left'
                    },
                    series: [
                        {
                            name: 'Access From',
                            type: 'pie',
                            radius: '70%',
                            data: [
                                {value: re.data.a1, name: '学习焦虑'},
                                {value: re.data.a2, name: '对人焦虑'},
                                {value: re.data.a3, name: '孤独倾向'},
                                {value: re.data.a4, name: '自责倾向'},
                                {value: re.data.a5, name: '过敏倾向'},
                                {value: re.data.a6, name: '身体症状'},
                                {value: re.data.a7, name: '恐怖倾向'},
                                {value: re.data.a8, name: '冲动倾向'},
                                {value: re.data.a9, name: '效度评估'}
                            ],
                            emphasis: {
                                itemStyle: {
                                    shadowBlur: 10,
                                    shadowOffsetX: 0,
                                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                                }
                            }
                        }
                    ]
                };
                option && myChart.setOption(option);
            },
        })
    });
</script>
</html>

